﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace TTEngine.Impl.Desktop
{
    public class Platform : TTEngine.IPlatform
    {
        public string Name
        {
            get
            {
                if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    return "Desktop_OSX";
                }
                else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    return "Desktop_Windows";
                }
                else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                {
                    return "Desktop_Linux";
                }
                else
                {
                    return "Desktop_unknown";
                }
            }
        }

        Process proccur = null;
        public long MemoryUse
        {
            get
            {
                if (proccur == null) proccur = Process.GetCurrentProcess();
                //Process proc = Process.GetCurrentProcess();
                return proccur.PrivateMemorySize64 / 1024;
            }
        }
        //非移动平台，管这些干嘛
        public float BatteryLevel => 0;

        public TTEngine.BatteryState BatteryState => TTEngine.BatteryState.Unknown;
    }

}
